<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        width: 800px;
        height: 400px;
        background-color: green;
      }
    </style>
  </head>
  <body>
    <div class="container"></div>
    <script src="./js/echarts.min.js"></script>
    <script>
      const myEachrts = echarts.init(document.querySelector(".container"));
      const option = {
        title: {
          text: "这是一个标题",
          textStyle: {
            fontSize: 30,
            color: "pink",
          },
          subtext: "这是副标题",
          subtextStyle: {
            fontSize: 20,
          },
          left: "center",
        },
        // x轴
        xAxis: {
          data: [
            "星期一",
            "星期二",
            "星期三",
            "星期四",
            "星期五",
            "星期六",
            "星期日",
          ],
          axisLine: {
            show: true,
            lineStyle: {
              color: "rgb(255, 0, 0)",
            },
          },
          // 刻度线
          dxisTick: {
            show: true,
          },
          axisLabel: {
            color: "deeppink",
          },
        },
        // y轴
        yAxis: {
          axisLine: {
            show: true,
            lineStyle: {
              color: "pink",
            },
          },
        },
        series: [
          {
            // 图表数据
            data: [20, 30, 50, 135, 62, 44, 25],
            // 图表类型
            type: "bar",
            // 图形样式
            itemStyle: {
              color: "hotpink",
              borderRadius: [5, 5, 0, 0],
            },
            // 图形文本
            label: {
              show: true,
              position: "top",
              color: "pink",
            },
            name: "Bar",
          },
        ],
        // 图例 切换显示隐藏
        legend: {
          right: 10,
        },
        // 放大 & 缩小
        dataZoom: {},
      };
      myEachrts.setOption(option);
    </script>
  </body>
</html>
